{
Author:  Prof1983 prof1983@yandex.ru
Created: 05.11.2008
LastMod: 17.03.2009
}
unit AUIclFont;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
  Classes, Controls, Graphics, StdCtrls,
  ABase, AUI, AUIcl;

type
  TAUIFont = class(TInterfacedObject, IAUIclFont, IAUIFont)
  private
    FControl: TFont;
  protected
    function GetCharset: Integer;
    function GetColor: Integer;
    function GetHeight: Integer;
    function GetName: AString;
    function GetPitch: Integer;
    function GetSize: Integer;
    procedure SetCharset(Value: Integer);
    procedure SetColor(Value: Integer);
    procedure SetHeight(Value: Integer);
    procedure SetName(const Value: AString);
    procedure SetPitch(Value: Integer);
    procedure SetSize(Value: Integer);
  public
    constructor Create(Control: TFont);
  end;

implementation

{ TAUIFont }

constructor TAUIFont.Create(Control: TFont);
begin
  FControl := Control;
end;

function TAUIFont.GetCharset: Integer;
begin
  Result := FControl.Charset;
end;

function TAUIFont.GetColor: Integer;
begin
  Result := FControl.Color;
end;

function TAUIFont.GetHeight: Integer;
begin
  Result := FControl.Height;
end;

function TAUIFont.GetName: AString;
begin
  Result := FControl.Name;
end;

function TAUIFont.GetPitch: Integer;
begin
  case FControl.Pitch of
    fpDefault: Result := 0;
    fpVariable: Result := 1;
    fpFixed: Result := 2;
  else
    Result := -1;
  end;
end;

function TAUIFont.GetSize: Integer;
begin
  Result := FControl.Size;
end;

procedure TAUIFont.SetCharset(Value: Integer);
begin
  FControl.Charset := Value;
end;

procedure TAUIFont.SetColor(Value: Integer);
begin
  FControl.Color := Value;
end;

procedure TAUIFont.SetHeight(Value: Integer);
begin
  FControl.Height := Value;
end;

procedure TAUIFont.SetName(const Value: AString);
begin
  FControl.Name := Value;
end;

procedure TAUIFont.SetPitch(Value: Integer);
begin
  if (Value = 0) then FControl.Pitch := fpDefault;
  if (Value = 1) then FControl.Pitch := fpVariable;
  if (Value = 2) then FControl.Pitch := fpFixed;
end;

procedure TAUIFont.SetSize(Value: Integer);
begin
  FControl.Size := Value;
end;

end.
